<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <button id="ldh">刘德华</button>
    <button id="zxy">张学友</button>
    <img src="" alt="">
    <script>
        // 修改元素属性src
        // 1、获取元素
        var ldh = document.getElementById('ldh');
        var zxy = document.getElementById('zxy');
        var img = document.getElementById('img');
        // 2、注册事件 处理程序
        zxy.onclick = function () {
            img.src = 'images/zxy.jpg';
        }
    </script>
</body>

</html>